package com.xiaoming.backend.service.impl;

import com.xiaoming.backend.dao.impl.FacilityDao;
import com.xiaoming.backend.dto.request.FacilityRequest;
import com.xiaoming.backend.entity.db.po.FacilityPO;
import com.xiaoming.backend.entity.orm.Facility;
import com.xiaoming.backend.service.IFacilityService;
import com.xiaoming.backend.util.DeepCopyUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class FacilityServiceImpl implements IFacilityService {
    private final FacilityDao facilityDao;

    @Override
    public void registerFacility(FacilityRequest facilityRequest) {
        Facility facility = DeepCopyUtil.copyByJackson(facilityRequest, Facility.class);
        facilityDao.registerFacility(facility);
    }

    @Override
    public List<Facility> getFacility(String facilityType) {
        return facilityDao.getFacility(facilityType);
    }
}
